package com.chouxiaozi.controller;

import com.chouxiaozi.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class HelloController {
    @Autowired
    HelloService helloService;

    @GetMapping(value = "/hello", produces = "text/html;charset=utf-8")
    public String sayHello(){
        return helloService.sayHello();
    }

    @GetMapping(value = "/data",produces = "application/json;charset=utf-8")
    public List<String> getData(){
        List<String> list = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
            list.add("你好===》"+ i);
        }
        return list;
    }
}
